<template>
  <div class="screen-container" style="display: inline-block" @click="hClick">
    <i :class="istoggle ? 'iconfont icon-exit-fullscreen' : ' iconfont  icon-fullscreen'"></i><i>{{ isFullScreen }}</i>
  </div>
</template>

<script>
import screenfull from 'screenfull'
export default {
  name: 'FirstProjectScreenfull',
  data() {
    return {
      istoggle: false
    }
  },
  created() {
    screenfull.on('change', () => {
      console.log('是否是全屏:', screenfull.isFullscreen)
      this.istoggle = screenfull.isFullscreen
    })
  },
  methods: {
    hClick() {
      screenfull.toggle()
      this.istoggle = !this.istoggle
    }
  },
  computed: {
    isFullScreen() {
      return this.istoggle === true ? '局部' : '全屏'
    }
  }
}
</script>

<style lang="scss" scoped>
.screen-container {
  width: 150px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  i {
    width: 30px;
    height: 30px;
    color: #fff;
    cursor: pointer;
    font-size: 23px;
    font-style: normal;
  }
}
</style>
